import React, { Component } from 'react'
import Tabbar from "./components/tabbar/Tabbar"
import { HashRouter as Router, Route, Switch, Redirect } from "react-router-dom"
import Home from "./components/home/Home"
import Category from "./components/category/Category"
import Cart from "./components/cart/Cart"
import My from "./components/my/My"
import SearchCenter from "./components/searchCenter/SearchCenter"
import Test from './components/test/Test'
import GoodDetail from './components/goodDetail/GoodDetail'
export default class App extends Component {
  render() {
    return (
      <div>
        {/* 配置路由 */}
        <Router>
          <Switch>
            <Route path="/home" render={(props) => <Tabbar {...props}><Home></Home></Tabbar>}></Route>
            <Route path="/category" render={(props) => <Tabbar {...props}><Category></Category></Tabbar>}></Route>
            <Route path="/cart" render={(props) => <Tabbar {...props}><Cart></Cart></Tabbar>}></Route>
            <Route path="/my" render={(props) => <Tabbar {...props}><My></My></Tabbar>}></Route>
            <Route path="/searchCenter" render={() => <SearchCenter></SearchCenter>}></Route>
            <Route path="/test" render={() => <Test></Test>}></Route>
            <Route path="/goodDetail/:goods_id" render={(props) => <GoodDetail {...props}></GoodDetail>}></Route>
            <Redirect to="/home"></Redirect>
          </Switch>
        </Router>
      </div>
    )
  }
}
